<html>
<head><meta charset="utf-8"><title>specialization fix for Error/Debug · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html">specialization fix for Error/Debug</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="236389249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389249">(Apr 27 2021 at 18:48)</a>:</h4>
<p><span class="user-mention" data-user-id="344196">@Jakub Duchniewicz</span> from the meeting, you asked about the examples niko gave for the possible work around to the specialization soundness issue</p>



<a name="236389256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389256">(Apr 27 2021 at 18:48)</a>:</h4>
<p>here are the notes I took in the meeting</p>



<a name="236389262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389262">(Apr 27 2021 at 18:48)</a>:</h4>
<div class="codehilite"><pre><span></span><code>Spec(Error) means ‘I implement Error in a lifetime agnostic way’

Impl&lt;’a&gt; error for mytype&lt;’a&gt; // ok

Struct mytype&lt;’a, ‘b&gt; { }
impl&lt;’a&gt; error for mytype&lt;’a, ‘a&gt; // not ok, requiring ‘b = ‘a

impl&lt;T&gt; Error for Box&lt;T&gt; where T: Error

Impl Error for MyType&lt;’static&gt;
</code></pre></div>



<a name="236389306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389306">(Apr 27 2021 at 18:49)</a>:</h4>
<p>so the first line was a random throw away syntax for what it would look like</p>



<a name="236389340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389340">(Apr 27 2021 at 18:49)</a>:</h4>
<p>and then the rest of them are examples of the issue</p>



<a name="236389349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389349">(Apr 27 2021 at 18:49)</a>:</h4>
<p>where the first one implements error for all lifetimes</p>



<a name="236389369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389369">(Apr 27 2021 at 18:49)</a>:</h4>
<p>but the other 3 potentially implement error conditionally based on lifetimes</p>



<a name="236389457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236389457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236389457">(Apr 27 2021 at 18:50)</a>:</h4>
<p>so the idea would be that we would specialize only for error impls that don't condition the impl on any lifetimes, and we would probably also add a lint to warn on impls that are conditional and might not specialize</p>



<a name="236390330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/specialization%20fix%20for%20Error/Debug/near/236390330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/specialization.20fix.20for.20Error.2FDebug.html#236390330">(Apr 27 2021 at 18:57)</a>:</h4>
<p>thanks, this makes it much clearer. Did not know about this soundness before you mentioned it recently!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>